include $(TOPDIR)/rules.mk

# 包信息定义
PKG_NAME:=ucode-lua-link
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=outman <routeman@foxmail.com>
PKG_LICENSE:=MIT

include $(INCLUDE_DIR)/package.mk

# 包定义
define Package/$(PKG_NAME)
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=Symlink for ucode to lua dir
  DEPENDS:=
endef

define Package/$(PKG_NAME)/description
  This package creates a symlink from /usr/share/lua to /usr/lib/lua for ucode compatibility.
endef

# 空构建步骤（无需编译）
define Build/Prepare
	@echo "No build needed for this package."
endef

define Build/Configure
	@echo "No configuration needed."
endef

define Build/Compile
	@echo "No compilation needed."
endef

# 安装文件到目标系统
define Package/$(PKG_NAME)/install
	# 创建 /etc 目录（若不存在）
	$(INSTALL_DIR) $(1)/etc/uci-defaults

	# 安装文件（从包内的 files/ 目录复制到目标 /etc）
	#$(INSTALL_DATA) ./files/file1.conf $(1)/etc/
	#$(INSTALL_DATA) ./files/file2.conf $(1)/etc/

	# 可选：设置文件权限（默认 root:root，0644）
	$(INSTALL_BIN) ./files/etc/uci-defaults/99-ucode-lua-link $(1)/etc/uci-defaults/
endef

# 标记文件为配置文件（升级时保留用户修改）
#define Package/$(PKG_NAME)/conffiles
# /etc/file1.conf
# /etc/file2.conf
#endef

$(eval $(call BuildPackage,$(PKG_NAME)))